using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class RangeValidatorByCodePage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Label label = new Label();
        label.Text = "Your Date Of Birth:";
        this.form1.Controls.Add(label);
        TextBox textBox = new TextBox();
        textBox.ID = "DOB";
        this.form1.Controls.Add(textBox);        
        Button button = new Button();
        button.Text = "OK";
        this.form1.Controls.Add(button);
        RangeValidator rangeValidator = new RangeValidator();
        rangeValidator.ControlToValidate = textBox.ID;
        rangeValidator.Type = ValidationDataType.Date;
        rangeValidator.Text = "Invalid date";
        rangeValidator.MinimumValue = "1/1/1970";
        rangeValidator.MaximumValue = "1/1/2010";
        this.form1.Controls.Add(rangeValidator);
    }
}
